UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'C9Vo+v6bqRFL4WnsQoQbtHPcohhlW1x5g1Uu9OBl7MM=' 
WHERE 
  key_id = 'a772a32e3577516978c9b88b01f103f2a49413ebf6ccd39f96b2ac12589943ef' 
  AND (
    token = 'C9Vo+v6bqRFL4WnsQoQbtHPcohhlW1x5g1Uu9OBl7MM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043