UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XmjcuUvJtAxswA8XnB0cTwPraDVFjE1Flj9lcQbpkzc=' 
WHERE 
  key_id = 'a361c437bf4640e9f46f184b162cd517b8e89b98ad054f25717f130c01b834ee' 
  AND (
    token = 'XmjcuUvJtAxswA8XnB0cTwPraDVFjE1Flj9lcQbpkzc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047