UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WmHrB/WK3HeREekCj0Nj/xH6b3/T9UwQLeuuQKQCp7Q=' 
WHERE 
  key_id = 'af87d0eb125239667407a32ca6126dd678885bfe073c68d4665a0aa92acc922f' 
  AND (
    token = 'WmHrB/WK3HeREekCj0Nj/xH6b3/T9UwQLeuuQKQCp7Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040