UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'H3JuxQHykQ6IR5NSTNndDkC8OOMYYfzcC3UrnLmvOLo=' 
WHERE 
  key_id = 'c66086a5a7f4fe9856087ffd3038408621920314a43fd376be412429b15db42c' 
  AND (
    token = 'H3JuxQHykQ6IR5NSTNndDkC8OOMYYfzcC3UrnLmvOLo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034