UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Wtz0iJ91Uusj1z6dmF3QGNlMxx1njodsFkVHI/sKw3c=' 
WHERE 
  key_id = '1e92a5d61ca1685a452439a1114461ddefa9889bcc8f2c2930617f89ee7d3cae' 
  AND (
    token = 'Wtz0iJ91Uusj1z6dmF3QGNlMxx1njodsFkVHI/sKw3c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034