UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Tm9+zFCEmRVSIIU0BsMGfZJjMc4GQTPj94napc/C448=' 
WHERE 
  key_id = 'c446744ace831c12afdc3874f0b95af1558f07897978a2d568c475d5704387c7' 
  AND (
    token = 'Tm9+zFCEmRVSIIU0BsMGfZJjMc4GQTPj94napc/C448=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029