UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OMUVo/IFSe0lC5wwfolQNxMSLqd2Lz0JMgbs2lmAHS0=' 
WHERE 
  key_id = '6bee166f59d13036d9e4a8032a3193e13558058548e673683d1228e01d54ce84' 
  AND (
    token = 'OMUVo/IFSe0lC5wwfolQNxMSLqd2Lz0JMgbs2lmAHS0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053