UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZL8UnKfSmHrfbw4ENiuDQ+RT34+NDc5QZKJPhlJYb2s=' 
WHERE 
  key_id = '39c305a3338949a4b25c3c9efe30b7a09993862de0e9ff1c7f5bc1abd1334bdc' 
  AND (
    token = 'ZL8UnKfSmHrfbw4ENiuDQ+RT34+NDc5QZKJPhlJYb2s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017