UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BNO4CMDd2nno+sx4BAdh3Ap+0t814iTXbYck1EshygQ=' 
WHERE 
  key_id = '940970a2fc200f389276df91493d6a2d6178a0ba8c515603203cd987908525b4' 
  AND (
    token = 'BNO4CMDd2nno+sx4BAdh3Ap+0t814iTXbYck1EshygQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043