UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CD8CfjApppIheaZpWx5SZ4159YfaXDQOiRZ7JPXfne8=' 
WHERE 
  key_id = '9fcc084085c73ad12d254266177409e8112da0d479fc78077e0395b63c11d02a' 
  AND (
    token = 'CD8CfjApppIheaZpWx5SZ4159YfaXDQOiRZ7JPXfne8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049