UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PumH3XL3P1rouwIOznwdLB1k4ktKIZygb0XWh5LxfI8=' 
WHERE 
  key_id = '204607c43b635eed51925099a574695c5a64bb3a9bcdfcf5d5aa76df95bc5e34' 
  AND (
    token = 'PumH3XL3P1rouwIOznwdLB1k4ktKIZygb0XWh5LxfI8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046