UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OCqgZjVdHEfqQHuRyVD/KYEV4cGkmip0zIjk41Azj+c=' 
WHERE 
  key_id = '6cc01eace060fbbcefb56fe4ecfd55b4f31034ec6785b6d6b8a8099c4aee0532' 
  AND (
    token = 'OCqgZjVdHEfqQHuRyVD/KYEV4cGkmip0zIjk41Azj+c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026