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

Query time 0.00023