UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Yv0/dqRtRmHj1qQZRekteQ1EPOCL8u79gV3YSJMHfB8=' 
WHERE 
  key_id = '9579fac7805daee110e41bb45e0c7c4a6b344dfee12114bb5d9a50cdb675dd8f' 
  AND (
    token = 'Yv0/dqRtRmHj1qQZRekteQ1EPOCL8u79gV3YSJMHfB8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040