UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Bn0W8O+otQkiReBZmhFugi8h8x2bBADs2H1i64x7nPg=' 
WHERE 
  key_id = '3a5d9e3206cfae54f1145b082473a6281e399962254e6be8538616e1187dbdc1' 
  AND (
    token = 'Bn0W8O+otQkiReBZmhFugi8h8x2bBADs2H1i64x7nPg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017