UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mVwq3lWjN7bdwWuI4uifZoyUWcAXqkese5VwFI16TEI=' 
WHERE 
  key_id = 'ba8be791e3569ac98a2612644365a770acb70084c9b6cc06eb42e30b02a5d428' 
  AND (
    token = 'mVwq3lWjN7bdwWuI4uifZoyUWcAXqkese5VwFI16TEI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016