UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'o7QlY0tykx8+n1DW1eL6bsghJcNv7Ng+lzCyZjvDvIA=' 
WHERE 
  key_id = '74dd1b4730eef81cacbb7b7f5f361f4147b5d7fe49167f199d879299b8c82096' 
  AND (
    token = 'o7QlY0tykx8+n1DW1eL6bsghJcNv7Ng+lzCyZjvDvIA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035