UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Osn6HXi1HXXCNqEFzSJ3TIw+t6aq7N53rNso8dwF8Yc=' 
WHERE 
  key_id = '11f3721709bec9e9988e034efbcbd2d9c4b37e8c4a12d4005ff69f51ad7f6dee' 
  AND (
    token = 'Osn6HXi1HXXCNqEFzSJ3TIw+t6aq7N53rNso8dwF8Yc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022