UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XjTxDMHqyLattaAzShKHihc4o7Uqldoszi+X4WN25+U=' 
WHERE 
  key_id = '0b65227f87a6c9cd8789bef3b0643d0e27667c3655fc691d2e4e31093545e732' 
  AND (
    token = 'XjTxDMHqyLattaAzShKHihc4o7Uqldoszi+X4WN25+U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035