UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Iwb6B1Z1BMW5T1U2mTHoSt3ZRhwATFMdmur8+Dbkjps=' 
WHERE 
  key_id = 'bd3f6273bf57de7d16a166612ffa7f2405db57d57a2e6916464293ba171752cd' 
  AND (
    token = 'Iwb6B1Z1BMW5T1U2mTHoSt3ZRhwATFMdmur8+Dbkjps=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047