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

Query time 0.00038