UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wRKVGK+uALT41PZXMlRZHOZcvhUEgriueryLHAmo7Yg=' 
WHERE 
  key_id = '0d9d626942dd0ceae09d2f5729aa5d6378a9fb97830c66e633451c0feda8a01f' 
  AND (
    token = 'wRKVGK+uALT41PZXMlRZHOZcvhUEgriueryLHAmo7Yg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023