UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fTbT+uB/441OONRj+gzQSkvYb3NoZ8ngbZe5pnxaztk=' 
WHERE 
  key_id = 'cf5333c08a4024b890996eb1f9b858f71d24bc831109d491ce574eb07a1c323e' 
  AND (
    token = 'fTbT+uB/441OONRj+gzQSkvYb3NoZ8ngbZe5pnxaztk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032