UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rpMK83hDsS6Kks/7E6NnM7a/uR6KS9nn9L/AKh24SFU=' 
WHERE 
  key_id = '5213b12d56042243a31588c05838eaad0b2524fd01d267efbf72ed58229c0829' 
  AND (
    token = 'rpMK83hDsS6Kks/7E6NnM7a/uR6KS9nn9L/AKh24SFU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033