UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BRpHZ1CcfJeZMLa3MrYL0aEzE9BG+NwhcPGKiXeaQl4=' 
WHERE 
  key_id = 'fdd84f4fa7a304d81b1f9326586b01ac05bd1ec89211d1e95773c9127f148ed5' 
  AND (
    token = 'BRpHZ1CcfJeZMLa3MrYL0aEzE9BG+NwhcPGKiXeaQl4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00062