UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'O0GfKQI6o5L2vuqmTBa4z3vsI+zy8tjtVEZ/PGI6t7I=' 
WHERE 
  key_id = '2083c8de6757afde7d6a3c321d3a9e7fa350e7ac689071df2038ee2b259971d5' 
  AND (
    token = 'O0GfKQI6o5L2vuqmTBa4z3vsI+zy8tjtVEZ/PGI6t7I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023