UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4Paar+XFkf4S38MmCbJYnOu80M8nD1lj0CgDIc44Diw=' 
WHERE 
  key_id = '1da32f4a89cb4852a068fefaba9d5ef162a00be10175bfb30475182244f5a35b' 
  AND (
    token = '4Paar+XFkf4S38MmCbJYnOu80M8nD1lj0CgDIc44Diw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041