UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'a0jkvYHj04pnFmHb5klvWsArrG+PF1BH+sjcQd5ACVI=' 
WHERE 
  key_id = '107ccd61aee177c15be579611e914b14d7e6b41cb4aaf487ad80de6b5a676005' 
  AND (
    token = 'a0jkvYHj04pnFmHb5klvWsArrG+PF1BH+sjcQd5ACVI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035