UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'x39gusaxlJ419L3VcwHjxnedoIyi1nGo4PjvpG1w5mk=' 
WHERE 
  key_id = '587aef579d293a0b1d02c341cd0561084b62cd4256637683dfd09c7a8136b9f3' 
  AND (
    token = 'x39gusaxlJ419L3VcwHjxnedoIyi1nGo4PjvpG1w5mk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048