UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9BPNRm96OqcBbSoag7h/0OXMSRpyFUikkqxm1XGAW38=' 
WHERE 
  key_id = 'd18378c5db1db59937bf21d086f00845c42816084d4af540342a01cc9433652c' 
  AND (
    token = '9BPNRm96OqcBbSoag7h/0OXMSRpyFUikkqxm1XGAW38=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033