UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Fn1wljfjhDxCEIT0IEB0afRjheGyxL4i8P6whHkP03k=' 
WHERE 
  key_id = 'a39ca261147cfd255208afe116c86b018075c461695e8235a5901713932ca4f8' 
  AND (
    token = 'Fn1wljfjhDxCEIT0IEB0afRjheGyxL4i8P6whHkP03k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028