UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '/V0TSWHgH+aow8iFC95Dg3RL/YZ7IUtfN2droh5xAoc=' 
WHERE 
  key_id = '17e307375e1149758016e38e95af2170e0c7e7a6f15c62d0aa827dce0225f8f9' 
  AND (
    token = '/V0TSWHgH+aow8iFC95Dg3RL/YZ7IUtfN2droh5xAoc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050