UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BgfjUydim0Txx/pb9l8QApMmz6NzgHbXDMtztf+ZstQ=' 
WHERE 
  key_id = '35d32356edc1d212f6b2f721425d34e6ca26007553ea960dd4f722bba5d9b1ef' 
  AND (
    token = 'BgfjUydim0Txx/pb9l8QApMmz6NzgHbXDMtztf+ZstQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042