UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vb2SbYbo56AoFFX6JYQ4d8XwzRw7BWSsRIxfn7dRKqY=' 
WHERE 
  key_id = '243a5296e72aa0c9a0be2c71258dc5d4e6b687a902f271fc2c7c2c1c1d058c0d' 
  AND (
    token = 'vb2SbYbo56AoFFX6JYQ4d8XwzRw7BWSsRIxfn7dRKqY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039