UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ppiTCYnnUWpAnxnIZXTM4NjDsjFd11s5+c8CfvRlnP0=' 
WHERE 
  key_id = '3de059ce27496045b90658a93c3c14c0c63505e23981f40f334a6f565a80d999' 
  AND (
    token = 'ppiTCYnnUWpAnxnIZXTM4NjDsjFd11s5+c8CfvRlnP0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034