UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'M+Povym06U8tODEA+JABs7EMaDEaWi/25BwabcBvkxk=' 
WHERE 
  key_id = 'cd1c696fc41285126cd1e8105de6cbccf27dd8545fe2a92ad69dd8ce24cf1b3c' 
  AND (
    token = 'M+Povym06U8tODEA+JABs7EMaDEaWi/25BwabcBvkxk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026