UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'w4dzgSCPbQhV97QLNR2yfpqXZTG/Y0eDn5LhCffqyJk=' 
WHERE 
  key_id = '7b62990d2ea2c30ed772b25b29fe2bf9f01d669213ebbf9657471df48815459a' 
  AND (
    token = 'w4dzgSCPbQhV97QLNR2yfpqXZTG/Y0eDn5LhCffqyJk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048