UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'G+Wj/UL9XKnrdtvSaPGm9Zcivv8lThVynZRl12zUqQg=' 
WHERE 
  key_id = '851ec820e0dc77068efb9059b499e88e399be715daac8e4573aa129c7ceb19e1' 
  AND (
    token = 'G+Wj/UL9XKnrdtvSaPGm9Zcivv8lThVynZRl12zUqQg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00056