UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ve+5iRTnWb/qIe9wlMR+2bOr41DuQ0Ydrwmc99wM3oY=' 
WHERE 
  key_id = 'dc5196a78600556b54674621e41810d3df0c6b70bd73350764cd014e80f50062' 
  AND (
    token = 'Ve+5iRTnWb/qIe9wlMR+2bOr41DuQ0Ydrwmc99wM3oY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00058